package mysql

import "gorm.io/gorm"

type Class struct {
	gorm.Model
	Name string `gorm:"type:varchar(30);not null;comment:分类名称"`
}

func (c *Class) FindClassByName(db *gorm.DB, name string) error {
	return db.Debug().Where("name=?", name).FirstOrCreate(c).Error
}
